﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DictionaryEdit.aspx.cs" Inherits="PropertyAppraisal.SystemManage.DictionaryEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../easyui/easyui/1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="/text/css" href="../easyui/easyui/1.3.2/themes/icon.css" />
    <script src="../easyui/easyui/1.3.2/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../easyui/easyui/1.3.2/jquery.easyui.min.js"></script>
    <script src="../easyui/easyui/1.3.2/easyloader.js"></script>
    <script type="text/javascript" src="../easyui/jquery.params.js"></script>

</head>
<body>
    <div>
            <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>   
        <table>
            <tbody id="tbtb">
                <tr>
                    <td><span>字典号：</span></td>
                    <td>
                        <input disabled="disabled" class="easyui-validatebox a" type="text" id="Dictionary_Number" data-options="required:true" /></td>
                </tr>
                <tr>
                    <td><span>字典名称：</span></td>
                    <td>
                        <input class="easyui-validatebox" missingMessage="必填" type="text" id="dictionary_Name" data-options="required:true" /></td>
                </tr>

                <tr>
                    <td colspan="2"><a href="#" id="saveDictionary" class="easyui-linkbutton">保存</a></td>
                </tr>
            </tbody>
        </table>

    </div>
    <script>

        //根据字典号反填数据到文本框
        var Dictionary_Number = $.query.get("Dictionary_Number");
        $(function () {
            $.ajax({
                type: "post", //要用post方式                 
                url: "DictionaryEdit.aspx/DictionarEdit",//方法所在页面和方法名
                data: "{'Dictionary_Number':'" + Dictionary_Number + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var json = eval("(" + data.d + ")");
                    $("#Dictionary_Number").val(json.Dictionary_Number);//字典号
                    $("#dictionary_Name").val(json.dictionary_Name);//字典名称
                    $("#dictionary_CreatePeople").val(json.dictionary_CreatePeople);//创建人
                }
            });
            //修改字典名称
            $("#saveDictionary").bind('click', function () {
                var Dictionary_Name = $("#dictionary_Name").val();
                $.ajax({
                    type: "post",
                    url: "DictionaryEdit.aspx/DoUpdateDic",
                    data: "{'Dictionary_Number':'" + Dictionary_Number + "','Dictionary_Name':'" + Dictionary_Name + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    async: false,
                    success: function (obj) {
                        obj = eval(obj)
                        if (obj) {
                            $.messager.alert('变更信息', '变更字典成功', 'info', function () {
                                parent.addTab("字典管理", "SystemManage/XiTongDic.aspx", "icon-chart-organisation", true);
                            });
                        }
                        else {
                            $.messager.alert('变更信息', '变更字典失败');
                        }
                    }
                })
            });
        });
    </script>
</body>
</html>
